<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="../../../common/include.jsp"%>
<input type="hidden" id="fileCount" name="fileCount" value="${fn:length(filelist)}"/>

<c:set var="config" value="${applicationScope.sysConfig}"></c:set>
<table id="fileListTable" width="390" border="0" cellpadding="0" cellspacing="0">
	<c:forEach items="${filelist}" var="uploadFile">
	<c:choose>
		<c:when test="${uploadFile.fileId eq null}">
			<c:if test="${param.isAdd eq 'true'}">
			<tr><td width="190" class="left_align"><input type="file" name="upload" onchange="fileSelected('${uploadFile.fileTypeId}')"></td><td class="left_align" width="40"><input type="hidden" name="xjFileTypeId" value="${uploadFile.fileTypeId }"><input type="hidden" name="xjFileName" value="${uploadFile.fileTypeName }"><input type="hidden" id="xjFileUploadState${uploadFile.fileTypeId}" name="xjFileUploadState" value="false"></td><td class="left_align">${uploadFile.fileTypeName}</td></tr>
			</c:if>
		</c:when>
		<c:otherwise>
			<tr id="${uploadFile.fileId}">
				<td width="190" class="left_align">
					<c:if test="${uploadFile.uploadLocation eq 'native'}">
					<a href="download.do?inputPath=${uploadFile.putPath}&filename=${uploadFile.fileName}">
					${uploadFile.fileName}
					</a>
					</c:if>
					<c:if test="${uploadFile.uploadLocation eq 'network'}">
					<a href="ftp://${config.ftpUser}:${config.ftpPassword}@${config.ftpServerIP}:${config.ftpServerPort}${uploadFile.putPath}">${uploadFile.fileName}</a>
					</c:if>
					<c:if test="${allowDeletions eq 'true'}">
						  <span class="upload_delete" onclick="deleteFile('${uploadFile.fileId}','${uploadFile.putPath}','${deleteFile}')">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
					</c:if>
				</td>
				<td width="40">
				</td>
				<td class="left_align">${uploadFile.fileTypeName}</td>
			</tr>
		</c:otherwise>
	</c:choose>
	</c:forEach>
</table>